package com.encapi.framework.wrapper.response;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

public class FastjsonResponseDataWrapper extends AbstractResponseDataWrapper<Object> {

    @Override
    protected String convertJson(Object needEncData) throws Exception{
        return JSON.toJSONString(needEncData,
                SerializerFeature.WriteNullStringAsEmpty,
                SerializerFeature.WriteDateUseDateFormat,
                SerializerFeature.WriteNullNumberAsZero,
                SerializerFeature.WriteNullBooleanAsFalse,
                SerializerFeature.WriteNullListAsEmpty);
    }

    @Override
    protected Object parseOriginData(Object originData) {
        return originData;
    }

    @Override
    protected Object wrapToEntity(Object originData, String encryptedData) {
        return encryptedData;
    }
}
